#ifndef DW_GRAFFITI_INDEX_BUFFER_H
#	define DW_GRAFFITI_INDEX_BUFFER_H

#include "hardwarebuffer.h"

namespace dw {
	namespace graffiti {

struct IndexBuffer
:	public HardwareBuffer< GL_ELEMENT_ARRAY_BUFFER >
{
public :
	typedef HardwareBuffer< GL_ELEMENT_ARRAY_BUFFER > base;

	IndexBuffer(buffer::update::frequency frequency, buffer::access::type access, attribute::type::types indexType)
	:	base(frequency, access)
	,	m_type(indexType)
	{
		dwAssert(attribute::type::isInt(indexType) && !attribute::type::isSigned(indexType), "Invalid parameter: indexType");
	}

public : //! @name Commands
	//! @{
	void resize(dw::uint32 indexCount)
	{
		base::resize(m_type, indexCount);
	}
	//! @}

public : //! @name State
	//! @{
	dw::uint32 getCount() const
	{
		return m_size / attribute::type::size(m_type);
	}

	attribute::type::types getType() const
	{
		return m_type;
	}
	//! @}

private : //! @name Data
	//! @{
	attribute::type::types m_type;
	//! @}
};

	} // namespace graffiti
} // namespace dw

#endif // !DW_GRAFFITI_INDEX_BUFFER_H
